GitHub Actions
リポジトリに.github/workflows/*.ymlを置く
Cronを複数のリポジトリで使用した時
最短で5分で実行されるが、それより長い時間がかかってしまう?
便利な機能
workflow_dispatch
APIや手動でworkflowを実行できる
repository_dispatch
他のrepositoryをトリガーにworkflowを実行できる
マーケットプレイスに公開されている
code: aws.yml
name: AWS example workflow
on:
push:
branches:
- main
env:
BUCKET_NAME : "<example-bucket-name>"
AWS_REGION : "<example-aws-region>"
jobs:
main:
runs-on: ubuntu-20.04
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::1234567890:role/example-role
role-session-name: samplerolesession
aws-region: ${{ env.AWS_REGION }}
- name: Copy index.html to s3
run: |
aws s3 cp ./index.html s3://${{ env.BUCKET_NAME }}/
Reference